#ifndef RASTER_HPP
#define RASTER_HPP

#include "typeAliases.hpp"

#include <limits>

namespace hms::raster {

class Raster
{
public:
	static constexpr scalar noDataDefault {
		std::numeric_limits<scalar>::max()
	};

private:
	ArrayXXs m_values;
	scalar   m_cellsize;
	Array2s  m_bottomLeft; // always use corners internally, not cell centres
	scalar   m_noDataValue { noDataDefault };

public:
	Raster() = default;

	Raster(
		ArrayXXs&& values,
		scalar  cellsize,
		Array2s bottomLeft,
		bool    useCorners = true,
		scalar  noDataValue = noDataDefault
	);

	Raster(
		scalar  cellsize,
		Array2s bottomLeft,
		bool    useCorners = true,
		scalar  noDataValue = noDataDefault
	);

	Raster(
		scalar cellsize,
		scalar bottomLeftX,
		scalar bottomLeftY,
		bool   useCorners = true,
		scalar noDataValue = noDataDefault
	);

	auto values() const -> const ArrayXXs&;
	void values( ArrayXXs&& );

	auto size() const -> Array2i;
	auto nx() const -> Index;
	auto ny() const -> Index;

	auto cellsize() const -> scalar;
	void cellsize( scalar );

	auto bottomLeft() const -> const Array2s&;
	void bottomLeft( Array2s );

	auto noDataValue() const -> scalar;
	void noDataValue( scalar );

private:
	Array2s storeBottomLeft(
		scalar cellsize, Array2s bottomLeft, bool useCorners
	);
};

} // namespace hms::raster

#endif